/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package frmsystem.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.ScrollPane;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SpringLayout;

import frmsystem.IDomain;

/**
 *
 * @author bahria
 */
public final class MainUI extends JFrame {

    private OperationPanel opPanel;
    private TransactionButtonPanel transPanel;
    private JScrollPane tableScroll;
    private JTable jTable;
    private GridBagLayout layout = new GridBagLayout();
    private GridBagConstraints c = new GridBagConstraints();
    
    public MainUI(OperationPanel opPanel, TransactionButtonPanel transPanel, JTable table, int width, int height){
    	this.opPanel = opPanel;
    	this.transPanel = transPanel;
    	this.jTable = table;
    	getContentPane().setLayout(layout);
    	
    	c.fill = GridBagConstraints.HORIZONTAL;
    	c.gridx = 0;
    	c.gridy = 0;
    	c.gridwidth = 2;
    	getContentPane().add(this.opPanel, c);
    	
    	
    	/*layout.putConstraint(SpringLayout.NORTH, opPlacePanel, 10, SpringLayout.NORTH, getContentPane());
    	layout.putConstraint(SpringLayout.WEST, opPlacePanel, 10, SpringLayout.WEST, getContentPane());*/
    	
    	//tablePlacePanel.setLayout(new SpringLayout());
    	this.tableScroll = new JScrollPane(this.jTable);
    	c.fill = GridBagConstraints.VERTICAL;
    	c.gridx = 0;
    	c.gridy = 1;
    	c.gridwidth = 1;
    	getContentPane().add(this.tableScroll, c);
    	/*layout.putConstraint(SpringLayout.NORTH, tablePlacePanel, 10, SpringLayout.SOUTH, opPlacePanel);
    	layout.putConstraint(SpringLayout.WEST, tablePlacePanel, 0, SpringLayout.WEST, opPlacePanel);*/
    	
    	//transPlacePanel.setLayout(new SpringLayout());
    	c.fill = GridBagConstraints.VERTICAL;
    	c.gridx = 1;
    	c.gridy = 1;
    	c.gridwidth = 1;
    	getContentPane().add(this.transPanel, c);
    	/*layout.putConstraint(SpringLayout.NORTH, transPlacePanel, 0, SpringLayout.NORTH, tablePlacePanel);
    	layout.putConstraint(SpringLayout.WEST, transPlacePanel, 10, SpringLayout.EAST, tablePlacePanel);*/
    	
    	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	pack();	
    	
    }
}
